package com.kindsoft.demo.ldap;

import lombok.Data;
import org.springframework.ldap.odm.annotations.*;

import javax.naming.Name;

//@Entry(base = "dc=wdcloud,dc=cc", objectClasses = "inetOrgPerson")
@Entry(objectClasses = "inetOrgPerson")
@Data
public class AdLdapOrgUser {

    @Id
    private Name id;

    @DnAttribute(value = "uid", index = 3)
    private String uid;

    @Attribute(name = "cn")
    private String commonName;

    @Attribute(name = "memberOf")
    private String role;

    @Attribute(name = "sn")
    private String userName;

    private String userPassword;

    public Name getId() {
        return id;
    }

    public void setId(Name id) {
        this.id = id;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getCommonName() {
        return commonName;
    }

    public void setCommonName(String commonName) {
        this.commonName = commonName;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    @Override
    public String toString() {
        return "AdLdapOrgUser{" +
                "id=" + id +
                ", uid='" + uid + '\'' +
                ", commonName='" + commonName + '\'' +
                ", role='" + role + '\'' +
                ", userName='" + userName + '\'' +
                ", userPassword='" + userPassword + '\'' +
                '}';
    }
}
